package com.santu.edu.supporter.biz.school.controller;

import com.santu.edu.supporter.biz.school.pojo.dto.SchoolDTO;
import com.santu.edu.supporter.biz.school.service.SchoolService;
import javax.validation.constraints.NotBlank;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author luoyaoqi
 * @createTime 2024/2/21
 * @description
 */
@RestController
@Validated
@RequiredArgsConstructor
@RequestMapping("school")
public class SchoolController {

    private final SchoolService schoolService;

    @PostMapping("add")
    public Boolean addBuilding(@NotBlank(message = "学校名称不能为空") String schoolName) {
        return schoolService.addSchool(schoolName);
    }
    @GetMapping("get/list")
    public List<SchoolDTO> getSchoolIdByName(String schoolName) {
        return schoolService.getSchoolIdByName(schoolName);
    }
}
